package com.szh.cc.controller;

import com.szh.cc.entity.Order;
import com.szh.cc.service.OrderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/web")
public class OrderWeb {

    @Resource
    private OrderService orderService;

    @PostMapping("/add")
    public Long createOrder(@RequestBody Order order){
        Long orderId = orderService.create(order);
        return orderId;
    }

    @GetMapping("/list")
    public List<Order> getList(){
        List<Order> list = orderService.list();
        return list;
    }
}
